import React, {Component} from 'react';
import NCUploader from 'uap/common/components/NCUploader';

class FileUpload extends Component {
    constructor(props) {
        super(props);
        this.state = {
            showUploader: false,
            target: null,
            groupLists: [],
            billId: ''
        }
    }

    //获取当前附件列表
    getGroupList = (list) => {
        this.setState({
            groupLists: list
        })
    }
    // 附件的关闭点击
    onHideUploader = () => {
        this.setState({
            showUploader: false,
            groupLists: []
        })
    }

    beforeUpload(billId, fullPath, file, fileList) {
        return true;
    }

    // 打开附件上传组件
    showUploader(billId) {
        this.setState({
            showUploader: true,
            billId
        })
    }

    render() {
        let {showUploader, target} = this.state;
        return (
            <div className="fileUpload">
                {/*直接传要传过来的数据*/}
                <div className="loader">
                    {showUploader && <NCUploader
                            // disableDownload={true}
                            billId={this.state.billId}
                            // billNo={'001'}
                            // target={target}
                            // customize={{uploadTrpe: '0'}}
                            placement={'top'}
                            // getGroupList={this.getGroupList}
                            uploadTitle={this.props.json['cm6011-000062"']} // 附件管理
                            onHide={this.onHideUploader} // 关闭功能
                            // beforeUpload={this.beforeUpload}
                        />
                    }
                </div>
            </div>
        )
    }
}

export default FileUpload
